<template>
  <div>
    <van-nav-bar left-arrow @click-left="onClickLeft" />
    <div class="promote">
      <div>
        <img class="top_banner" src="../../assets/image/mall_3.png" alt="" />
        <p class="cont">
          我的金币 <img src="../../assets/image/money.png" alt="" />0
        </p>
        <ul>
          <li v-for="(item, index) in list" :key="index">
            <div class="pic">
              <img
                src="http://10.31.169.33:3000/images/Promote/mall_0.png"
                alt=""
              />
            </div>
            <div class="txt">
              <p class="title">{{ item.title }}</p>
              <p class="content">
                <span>{{ item.sold }}</span
                ><img src="../../assets/image/money.png" alt="" /><i>100</i>
              </p>
            </div>
          </li>
        </ul>
      </div>
    </div>
  </div>
</template>

<script>
import { Toast, NavBar } from "vant";
import BScroll from "better-scroll";
export default {
  data() {
    return {
      list: null,
    };
  },
  mounted() {
    this.getList();
  },
  methods: {
    onClickLeft() {
      Toast("返回");
      this.$router.go(-1);
    },
    getList() {
      fetch(
        "https://www.fastmock.site/mock/c0f13bfba0d6d891ae48872314d8a865/aikeapp_01/api/Politeinvitation"
      )
        .then((response) => response.json())
        .then(async (res) => {
          if (res.status == 0) {
            this.list = res.result.list;
            await this.$nextTick();
            new BScroll(".promote", {
              scrollY: true,
              scrollX: false,
              click: true,
            });
          }
        });
    },
  },
  components: {
    "van-nav-bar": NavBar,
  },
};
</script>

<style lang="less" scoped>
@import "../../assets/css/var.less";
.promote {
  height: 620px;
  overflow: hidden;
}
.top_banner {
  width: 100%;
}
p.cont {
  display: flex;
  align-items: center;
  font-size: @s-font;
  margin-left: 10px;
  line-height: 32px;
  font-weight: bold;
  img {
    width: 16px;
    margin-left: 15px;
    margin-right: 3px;
  }
}
ul {
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
  padding: 0 8px;
}
li {
  width: 46%;
  flex-shrink: 1;
  border-radius: 20px;
  box-shadow: 0 0 10px -5px #000;
  margin-bottom: 25px;
  .txt {
    border-radius: 0 0 20px 20px;
    background-color: #f5f5f5;
    height: 60px;
    .title {
      font-weight: bold;
      font-size: @l-font;
      margin-top: 10px;
      margin-left: 10px;
      width: 100%;
      .write-nowarp();
    }
    .content {
      font-size: @s-font;
      padding: 0 10px;
      color: #c7ced7;
      img {
        margin-left: 50px;
        margin-right: 3px;
        margin-top: 10px;
        width: 16px;
      }
      i {
        color: #f6a738;
      }
    }
  }
  .pic {
    border-radius: 20px 20px 0 0;
    height: 180px;
    background-color: white;
    .center ();
    img {
      width: 75px;
    }
  }
}
</style>
